from datetime import datetime
from typing import Optional, List

from pydantic import BaseModel

from app.schemas.base_model import OrmBaseModel
from app.schemas.strategy_code import StrategyCodeBase, StrategyCodeSave, StrategyCodeDetail


class StrategyBase(OrmBaseModel):
    id: Optional[int]
    userId: Optional[int]
    parentId: Optional[int]
    name: Optional[str]
    level: Optional[int]
    password: Optional[str]
    drawType: Optional[str]
    description: Optional[str]
    createdDate: Optional[datetime]
    updatedDate: Optional[datetime]


class StrategyQuery(StrategyBase):
    pass


class StrategyItem(OrmBaseModel):
    id: Optional[int]
    userId: Optional[int]
    name: Optional[str]
    description: Optional[str]
    createdDate: Optional[datetime]
    updatedDate: Optional[datetime]

    realName: Optional[str]
    avatar: Optional[str]


class StrategyParam(BaseModel):
    variable: str
    value: float
    minValue: float
    maxValue: float


class StrategyDetail(StrategyBase):
    strategyCode: Optional[StrategyCodeDetail]


class StrategySave(BaseModel):
    id: Optional[int]
    userId: Optional[int]
    parentId: int
    name: str
    level: Optional[int]
    password: str
    drawType: str
    description: str
    strategyCode: StrategyCodeSave
    # createdDate: Optional[datetime]
    # updatedDate: Optional[datetime]




class Category(BaseModel):
    id: Optional[int]
    name: str
    parentId: int


class StrategyExecParam(BaseModel):
    code: str